package com.module.lemlin

import android.content.Context
import razerdp.basepopup.QuickPopupBuilder
import razerdp.widget.QuickPopup

object LoadingDialog {

    private var quickPopup: QuickPopup? = null

    fun show(
        context: Context,
        resId: Int = R.layout.dialog_load_auth,
        isBlurBackground: Boolean = false,
        backgroundColor: Int = 0
    ) {
        quickPopup = QuickPopupBuilder.with(context).run {
            contentView(resId)
            config(
                config.blurBackground(isBlurBackground)
                    .backgroundColor(backgroundColor)
            )
        }.show()
    }

    fun dismiss() {
        quickPopup?.dismiss()
        quickPopup = null
    }

}